<script setup lang="ts">
import router from '../config/router';
import {onMounted, ref} from "vue";
import {onBeforeRouteLeave, onBeforeRouteUpdate} from "vue-router";
// import { ref } from 'vue';
const onClickLeft = () => history.back();
const onClickRight = () => router.push("/search");
const title = ref()
// 获取当前路由名称
router.beforeEach((to,from)=>{
  console.log(to.meta)
  const {description} = to.meta
  title.value = description
})


</script>

<template>
    <!-- 导航栏 -->
    <van-nav-bar :title="title" left-text="返回" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
        <template #right>
            <van-icon name="search" size="18px" />
        </template>
    </van-nav-bar>
    <!-- 插槽 -->
    <!-- <div id="comment">
        <template v-if="active === 'home'">
            <Index></Index>
        </template>
        <template v-if="active === 'friends'">
            <Team></Team>
        </template>
        <template v-if="active === 'user'">
            <User></User>
        </template>
    </div> -->
    <router-view />
    <!-- 底部标签页 -->
    <van-tabbar route>
        <van-tabbar-item replace to="/" icon="home-o">首页</van-tabbar-item>
        <van-tabbar-item replace to="/team" icon="friends-o">队伍</van-tabbar-item>
        <van-tabbar-item replace to="/user" icon="user-o">个人</van-tabbar-item>
    </van-tabbar>
</template>

<style scoped></style>
